package com.dx.chat.server;

import com.dx.chat.util.AlertUtil;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

/**
 * Description: 页面渲染
 *
 * @author rockstarsteve
 * @version 1.0
 * @copyright Copyright (c) 电信
 * @since 2023/9/8
 */
public class ServerApplication extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("server.fxml"));
        Parent root = fxmlLoader.load();
        Scene scene = new Scene(root);
        //关闭窗口后全部退出
        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                System.exit(0);
            }
        });
        primaryStage.getIcons().add(new Image(AlertUtil.class.getResourceAsStream("/images/electron.png")));
        primaryStage.setTitle("服务端");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

}
